import { TreasuresPartCfgBase } from "./Sheets"
import { SheetManager } from "../../ccc3-framework-core/framework/modules/sheetManager";
import dataUtil from "../../ccc3-framework-core/framework/modules/dataUtil";
import { CategoryDefine } from "../../scripts/CustomDefine";
export class TreasuresPartCfg extends TreasuresPartCfgBase {
  //id索引
  public static get(id: any) {
    if ((this as any)[id]) return (this as any)[id];
    return SheetManager.get("TreasuresPartCfg", id, TreasuresPartCfg);
  }

  public static getAll(): TreasuresPartCfg[] {
    return SheetManager.getAllSheets("TreasuresPartCfg", TreasuresPartCfg);
  }

  public static testUnlockAll(parentId: number): boolean {
    let all = TreasuresPartCfg.getAll();
    all.filter(item => item.parentId == parentId);
    let isUnlockAll = all.every(item => dataUtil.isUnlockById(item.ID, CategoryDefine.TREASURES_PART));
    return isUnlockAll;
  }


}